{include file="public_head" /}
<style>
    .table{
        background-color: #cafffa;
        margin-bottom: 0;
    }
</style>
<!-- datatables -->
<link href="__STATIC__/js/datatables/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
<!-- Select2 -->
<link href="__STATIC__/css/select/select2.min.css" rel="stylesheet">
<!-- chk_3 -->
<link href="__STATIC__/css/chk_3.css" rel="stylesheet" type="text/css"/>

<body class="nav-md">

<div class="container body">


    <div class="main_container">

        {include file="public_sidebar,public_nav" /}


        <!-- page content -->
        <div class="right_col" role="main">
            <div class="">
                <div class="page-title">
                    <div class="title_left">
                        <h3>
                            店铺商品管理
                        </h3>
                    </div>
                </div>
                <div class="clearfix"></div>

                <div class="row">

                    <div class="col-md-12 col-sm-12 col-xs-12">
                        <div class="x_panel">
                            <div class="x_title">
                                <h2>{$mate_title}
                                    <!--<small>ShopGoods</small>-->
                                </h2>
                                <a style="float: right" href="{:url('ShopGoods/classify')}"
                                   class="btn btn-success btn-sm">创建商品</a>
                                <div class="clearfix"></div>
                            </div>
                            <div class="x_content">
                                <form name="form" id="form" method="get" action="">
                                    <div class="x_content" style="margin-left: 15px;">
                                        <a href="{:url('ShopGoods/index',['orderId' => 'sort'])}"
                                           class="btn btn-round {eq name=':input("orderId")' value='sort'}btn-danger{else/}btn-default{/eq}"

                                        >综 合</a>
                                        <a href="{:url('ShopGoods/index',['orderId' => 'sale_number'])}"
                                           class="btn btn-round {eq name=':input("orderId")' value='sale_number'}btn-danger{else/}btn-default{/eq}">销 量</a>
                                        <a href="{:url('ShopGoods/index',['orderId' => 'create_time'])}"
                                           class="btn btn-round {eq name=':input("orderId")' value='create_time'}btn-danger{else/}btn-default{/eq}">时 间</a>
                                        <a href="{:url('ShopGoods/index',['orderId' => 'collect'])}"
                                           class="btn btn-round {eq name=':input("orderId")' value='collect'}btn-danger{else/}btn-default{/eq}">收 藏</a>
                                        <a href="{:url('ShopGoods/index',['orderId' => 'price'])}"
                                           class="btn btn-round {eq name=':input("orderId")' value='price'}btn-danger{else/}btn-default{/eq}">价 格</a>
                                    </div>
                                    <div class="title_left">
                                        <div class="col-md-7 col-sm-3 col-xs-12 form-group pull-left top_search">
                                            <div class="input-group" style="float: left;margin: 0 20px;">

                                                <select name="shop_class_id" class="select2_single" style="width: 200px;" tabindex="-1">
                                                    <option value="0">- 请选择栏目 -</option>

                                                    {volist name='shopClassify' id='shopClassData'}

                                                    <option
                                                            value="{$shopClassData.id}"
                                                            {eq name=':input("shop_class_id")' value='$shopClassData.id'}
                                                            selected
                                                            {/eq}
                                                    >
                                                    {neq name="shopClassData.parenTid" value="0"}
                                                    {:str_repeat('　',$shopClassData['count'])}
                                                    {/neq}
                                                    {eq name="shopClassData.parenTid" value="0"}
                                                    <span>&nbsp;</span>
                                                    {else /}
                                                    <span>&nbsp;</span>
                                                    {/eq}
                                                    {neq name="shopClassData.count" value="1"}|&nbsp;--&nbsp;{/neq}
                                                    {$shopClassData.title}
                                                    </option>
                                                    {/volist}
                                                </select>
                                            </div>
                                            <div class="input-group" style="float: left;margin: 0 20px;">

                                                <select name="status" class="select2_single" style="width: 200px;"
                                                        tabindex="-1">
                                                    <option value="0">- 请选择审核状态 -</option>
                                                    <option value="1" {eq name=':input("status")' value='1' }selected{/eq}>审核通过</option>
                                                    <option value="2" {eq name=':input("status")' value='2' }selected{/eq}>等待审核</option>
                                                </select>
                                            </div>
                                            <div class="input-group" style="float: left;margin: 0 20px;">

                                                <select name="promotion" class="select2_single" style="width: 200px;"
                                                        tabindex="-1">
                                                    <option value="0">- 请选择促销状态 -</option>
                                                    <option value="1" {eq name=':input("promotion")' value='1' }selected{/eq}>启用</option>
                                                    <option value="2" {eq name=':input("promotion")' value='2' }selected{/eq}>未启用</option>
                                                </select>
                                            </div>
                                            <div class="input-group">
                                                <input type="text" class="form-control" name="title"
                                                       placeholder="输入搜索内容..." value="{:input('title')}">
                                            </div>

                                        </div>
                                        <button type="submit" class="btn btn-primary" style="margin-left: 10px;">搜 索</button>
                                    </div>

                                    <table class="table table-striped table-bordered">
                                        <thead>
                                        <tr>
                                            <!--<td><input type="checkbox" class="checkall"-->
                                                       <!--onclick="CheckAll(this.checked);"/></td>-->
                                            <th>排序</th>
                                            <th>商品ID</th>
                                            <th>标题</th>
                                            <th>商品价格</th>
                                            <th>返利差价</th>
                                            <th>店铺栏目</th>
                                            <th>销量</th>
                                            <th>发布时间</th>
                                            {eq name=':cache("web_commodity_audit")' value='Y'}<th>审核状态</th>{/eq}
                                            <!--{eq name=':cache("web_related")' value='Y'}<th>猜你喜欢状态</th>{/eq}-->
                                            <th>店铺促销状态</th>
                                            <th>店长推荐状态</th>
                                            <!--<th>上架状态</th>-->
                                            <th>操作</th>
                                        </tr>
                                        </thead>

                                        <tbody>
                                        {empty name="data"}
                                        <tr><td {if condition='cache("web_commodity_audit") == "Y" && cache("web_related") == "Y"'}colspan="12"{elseif condition='cache("web_commodity_audit") == "Y" || cache("web_related") == "Y"'/}colspan="11"{else/}colspan="10"{/if}><div style='font-size:24px;margin:30px 0;'>没有找到记录</div></td></tr>
                                        {/empty}
                                        {volist name="data" id="item"}
                                        <tr>
                                            <!--<td><input type="checkbox" name="id[]" value="{$item.id}"/></td>-->
                                            <td width="40" align="center">
                                                <input class="form-control" style="width: 80px;text-align: center"
                                                       type="text" name="sort[]" value="{$item.sort}">
                                                <input type="hidden" name="orderId[]" value="{$item.id}">
                                            </td>
                                            <td>{$item.id}</td>
                                            <td style="width: 30%;">
                                                {$item.title|reStrLen=###,30}
                                                {if condition="$item.inventory_hint egt $item.inventory"}
                                                <b>库存不足</b>
                                                {/if}
                                            </td>
                                            <td>{$item.price} 元</td>
                                            <td>{$item.charges}元</td>
                                            <td>{$item.ShopParenText}</td>
                                            <td>{$item.sale_number} 个</td>
                                            <td>{$item.create_time|date='Y-m-d H:i:s',###}</td>
                                            {eq name=':cache("web_commodity_audit")' value='Y'}<td>{$item.StatusText}</td>{/eq}
                                            {eq name=':cache("web_related")' value='Y'}
                                            <!--<td>-->
                                                <!--<input type="checkbox" id="checkbox3_{$item.id}" class="chk_3"-->
                                                       <!--value="{$item.related}" {eq name="item['related']" value="1"}checked{/eq} />-->
                                                <!--<label style="margin-left: 30px;margin-top: 5px;"-->
                                                       <!--onclick="CheckInfo('{:url(\'ShopGoods/related\',[\'id\' => $item[\'id\']])}')"-->
                                                       <!--for="checkbox3_{$item.id}"></label>-->
                                            <!--</td>-->
                                            {/eq}
                                            <td>
                                                <input type="checkbox" id="checkbox_{$item.id}" class="chk_3"
                                                       value="{$item.recommend}" {eq name="item['recommend']" value="1"}checked{/eq} />
                                                <label style="margin-left: 30px;margin-top: 5px;"
                                                       onclick="CheckInfo('{:url(\'ShopGoods/auditing\',[\'id\' => $item[\'id\']])}')"
                                                       for="checkbox_{$item.id}"></label>
                                            </td>
                                            <td>
                                                <input type="checkbox" id="checkbox2_{$item.id}" class="chk_3"
                                                       value="{$item.shop_recommend}" {eq name="item['shop_recommend']" value="1"}checked{/eq} />
                                                <label style="margin-left: 30px;margin-top: 5px;"
                                                       onclick="CheckInfo('{:url(\'ShopGoods/shop_recommend\',[\'id\' => $item[\'id\']])}')"
                                                       for="checkbox2_{$item.id}"></label>
                                            </td>
                                            <!--<td>-->
                                                <!--<input type="checkbox" id="checkbox4_{$item.id}" class="chk_3"-->
                                                       <!--value="{$item.state}" {eq name="item['state']" value="1"}checked{/eq} />-->
                                                <!--<label style="margin-left: 30px;margin-top: 5px;"-->
                                                       <!--onclick="CheckInfo('{:url(\'ShopGoods/dispose_state\',[\'id\' => $item[\'id\']])}')"-->
                                                       <!--for="checkbox4_{$item.id}"></label>-->
                                            <!--</td>-->
                                            <td>
                                                <a href="{:url('ShopGoods/update', ['id' => $item['id']])}"
                                                   class="label label-primary">
                                                    <span class="fa fa-pencil"></span>&nbsp;&nbsp;编 辑
                                                </a>
                                                &nbsp;&nbsp;&nbsp;&nbsp;
                                                <a href="{:url('ShopGoods/destroy', ['id' => $item['id']])}"
                                                   class="label label-danger"
                                                   onClick="return confirm('确定删除吗?')"
                                                >
                                                    <span class="fa fa-times"></span>&nbsp;&nbsp;删 除
                                                </a>
                                            </td>
                                        </tr>
                                        {/volist}
                                        </tbody>
                                        <tbody align="left">
                                        <tr>
                                            <td {if condition='cache("web_commodity_audit") == "Y" && cache("web_related") == "Y"'}colspan="12"{elseif condition='cache("web_commodity_audit") == "Y" || cache("web_related") == "Y"'/}colspan="11"{else/}colspan="10"{/if}>
                                                <!--<span class="selArea"><span>选择：</span>-->
                                                    <!--<a style="color:#428BCA"-->
                                                       <!--href="javascript:DelAllNone('{:url(\'ShopGoods/destroy\')}');"-->
                                                       <!--onclick="return ConfDelAll(0);">选择删除</a>-->
                                                <!--</span>-->
                                                &nbsp;&nbsp;&nbsp;&nbsp;
                                                <span>控制：</span>
                                                <a style="color:#428BCA"
                                                   href="javascript:UpOrderID('{:url(\'ShopGoods/sorting\')}');">更新排序</a>
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                    <!-- 分页 -->
                                    <div style="float: right;margin-top: -30px;">{$data->render()}</div>
                                </form>
                            </div>
                        </div>
                    </div>

                </div>
            </div>

        </div>
        <!-- /page content -->
    </div>

</div>

{include file="public_foot" /}
<!--select-->
<script src="__STATIC__/js/select/select2.full.min.js"></script>
<!-- public -->
<script src="__STATIC__/js/public.js"></script>
<!-- layer -->
<script src="__STATIC__/js/layer.js"></script>
<script type="text/javascript">
    // list
    $(document).ready(function () {
        // select2
        $(".select2_single").select2({
            placeholder: "请选择分类",
            allowClear: true
        });
    });
</script>